#include <ctime>
#include <cassert>
#include <iostream>
#include <sys/time.h>
#include <unistd.h>

using namespace std;

int main()
{
    while (true)
    {
        cout << "time: " << (unsigned long)time(nullptr) << endl;
        struct timeval tv = {0, 0};
        int n = gettimeofday(&tv, nullptr);
        cout << "gettimeofday: " << tv.tv_sec << "." << tv.tv_usec << endl;
        sleep(1);
    }
    return 0;
}